import os

java_name = input('请输入java文件名：')

java_content = []
java_content.append('public class ' + java_name + ' {\n')
with open('target.txt', 'r', encoding='gbk') as f:
	# print(f.read())
	t = f.readlines();
	# print(type(t))
	# print(t[0].replace('\n','').split(' '))
	for i in t:
		f = i.replace('\n','').split(' ')
		inner_list = f[0].split('\t') 
		print(inner_list)
		java_content.append('    private ' + inner_list[1] + ' ' + inner_list[0] + '; // ' + ','.join(inner_list[2:]) + '\n')

	java_content.append('\n}')
	print(java_content)

target_package = 'target'

if not os.path.exists(target_package):
		os.makedirs(target_package)

with open(target_package + '/' + java_name + '.java', 'w', encoding='utf-8') as f:
	f.writelines(java_content)